package com.jack.xiaoer.entity;

import com.jack.xiaoer.constant.ShopStateEnum;
import com.jack.xiaoer.constant.ShopTypeEnum;
import com.jack.xiaoer.validator.Groups;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;

import javax.validation.constraints.Pattern;
import java.math.BigDecimal;
import java.time.Instant;

/**
 * Created by Jackaroo Zhang on 2018/12/11.
 */
public class Shop {

    private Long id;

    @NotBlank(message = "商家名称不能为空", groups = {Groups.ShopCreate.class})
    @Length(min = 3, max = 40, message = "商家名称长度要在3~40之间", groups = {Groups.ShopCreate.class})
    private String name;

    private String logoImg;

    private String description;

    @NotBlank(message = "商家电话不能为空", groups = {Groups.ShopCreate.class})
    @Pattern(regexp = "^((13[0-9])|(14[5,7,9])|(15([0-3]|[5-9]))|(17[0,1,3,5,6,7,8])|(18[0-9])|(19[8|9])|(16[6]))\\d{8}$"
            , message = "手机号码不合法"
            , groups = {Groups.ShopCreate.class})
    private String phone;

    private String shopImg;

    private String shopImgLarge;

    private BigDecimal packFee;

    @NotBlank(message = "店主姓名不能为空", groups = {Groups.ShopCreate.class})
    private String owner;

    @NotBlank(message = "商店地址不能为空", groups = {Groups.ShopCreate.class})
    private String address;

    private ShopTypeEnum type;

    private String productType;

    private String openTime;

    private BigDecimal latitude;

    private BigDecimal longitude;

    private ShopStateEnum state;

    private Instant gmtCreate;

    private Instant gmtModified;

    @Override
    public String toString() {
        return "Shop{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", logoImg='" + logoImg + '\'' +
                ", description='" + description + '\'' +
                ", phone='" + phone + '\'' +
                ", shopImg='" + shopImg + '\'' +
                ", shopImgLarge='" + shopImgLarge + '\'' +
                ", packFee=" + packFee +
                ", owner='" + owner + '\'' +
                ", address='" + address + '\'' +
                ", type=" + type +
                ", productType='" + productType + '\'' +
                ", openTime='" + openTime + '\'' +
                ", latitude=" + latitude +
                ", longitude=" + longitude +
                ", state=" + state +
                ", gmtCreate=" + gmtCreate +
                ", gmtModified=" + gmtModified +
                '}';
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getLogoImg() {
        return logoImg;
    }

    public void setLogoImg(String logoImg) {
        this.logoImg = logoImg;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getShopImg() {
        return shopImg;
    }

    public void setShopImg(String shopImg) {
        this.shopImg = shopImg;
    }

    public String getShopImgLarge() {
        return shopImgLarge;
    }

    public void setShopImgLarge(String shopImgLarge) {
        this.shopImgLarge = shopImgLarge;
    }

    public BigDecimal getPackFee() {
        return packFee;
    }

    public void setPackFee(BigDecimal packFee) {
        this.packFee = packFee;
    }

    public String getOwner() {
        return owner;
    }

    public void setOwner(String owner) {
        this.owner = owner;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public ShopTypeEnum getType() {
        return type;
    }

    public void setType(ShopTypeEnum type) {
        this.type = type;
    }

    public String getProductType() {
        return productType;
    }

    public void setProductType(String productType) {
        this.productType = productType;
    }

    public String getOpenTime() {
        return openTime;
    }

    public void setOpenTime(String openTime) {
        this.openTime = openTime;
    }

    public BigDecimal getLatitude() {
        return latitude;
    }

    public void setLatitude(BigDecimal latitude) {
        this.latitude = latitude;
    }

    public BigDecimal getLongitude() {
        return longitude;
    }

    public void setLongitude(BigDecimal longitude) {
        this.longitude = longitude;
    }

    public ShopStateEnum getState() {
        return state;
    }

    public void setState(ShopStateEnum state) {
        this.state = state;
    }

    public Instant getGmtCreate() {
        return gmtCreate;
    }

    public void setGmtCreate(Instant gmtCreate) {
        this.gmtCreate = gmtCreate;
    }

    public Instant getGmtModified() {
        return gmtModified;
    }

    public void setGmtModified(Instant gmtModified) {
        this.gmtModified = gmtModified;
    }
}
